From b094b2cecb0da1bcdf4c63dd081638d87793c53c Mon Sep 17 00:00:00 2001
From: MohamedBassem <me@mbassem.com>
Date: Mon, 26 Aug 2024 13:41:13 +0300
Subject: feature(mobile): Change the view bookmark page to be a modal and add
 tags and notes

---
 apps/mobile/app/dashboard/bookmarks/[slug].tsx | 82 --------------------------
 1 file changed, 82 deletions(-)
 delete mode 100644 apps/mobile/app/dashboard/bookmarks/[slug].tsx

(limited to 'apps/mobile/app/dashboard/bookmarks/[slug].tsx')

diff --git a/apps/mobile/app/dashboard/bookmarks/[slug].tsx b/apps/mobile/app/dashboard/bookmarks/[slug].tsx
deleted file mode 100644
index c7b0cead..00000000
--- a/apps/mobile/app/dashboard/bookmarks/[slug].tsx
+++ /dev/null
@@ -1,82 +0,0 @@
-import { View } from "react-native";
-import { Stack, useLocalSearchParams } from "expo-router";
-import BookmarkAssetImage from "@/components/bookmarks/BookmarkAssetImage";
-import BookmarkTextMarkdown from "@/components/bookmarks/BookmarkTextMarkdown";
-import CustomSafeAreaView from "@/components/ui/CustomSafeAreaView";
-import FullPageSpinner from "@/components/ui/FullPageSpinner";
-import PageTitle from "@/components/ui/PageTitle";
-import { api } from "@/lib/trpc";
-
-import { BookmarkTypes, ZBookmark } from "@hoarder/shared/types/bookmarks";
-
-function BookmarkTextView({ bookmark }: { bookmark: ZBookmark }) {
-  if (bookmark.content.type !== BookmarkTypes.TEXT) {
-    throw new Error("Wrong content type rendered");
-  }
-  const content = bookmark.content.text;
-
-  return (
-    <View className="flex gap-2">
-      <BookmarkTextMarkdown text={content} />
-    </View>
-  );
-}
-
-function BookmarkAssetView({ bookmark }: { bookmark: ZBookmark }) {
-  if (bookmark.content.type !== BookmarkTypes.ASSET) {
-    throw new Error("Wrong content type rendered");
-  }
-  return (
-    <View className="flex gap-2">
-      <BookmarkAssetImage
-        assetId={bookmark.content.assetId}
-        className="h-56 min-h-56 w-full object-cover"
-      />
-    </View>
-  );
-}
-
-export default function BookmarkView() {
-  const { slug } = useLocalSearchParams();
-  if (typeof slug !== "string") {
-    throw new Error("Unexpected param type");
-  }
-
-  const { data: bookmark } = api.bookmarks.getBookmark.useQuery({
-    bookmarkId: slug,
-  });
-
-  let comp;
-  let title = null;
-  if (bookmark) {
-    switch (bookmark.content.type) {
-      case BookmarkTypes.LINK:
-        comp = null;
-        break;
-      case BookmarkTypes.TEXT:
-        title = bookmark.title;
-        comp = <BookmarkTextView bookmark={bookmark} />;
-        break;
-      case BookmarkTypes.ASSET:
-        title = bookmark.title ?? bookmark.content.fileName;
-        comp = <BookmarkAssetView bookmark={bookmark} />;
-        break;
-    }
-  } else {
-    comp = <FullPageSpinner />;
-  }
-
-  return (
-    <CustomSafeAreaView>
-      <Stack.Screen
-        options={{
-          headerTitle: "",
-          headerBackTitle: "Back",
-          headerTransparent: true,
-        }}
-      />
-      <PageTitle title={title ?? "Untitled"} />
-      <View className="px-4 py-2">{comp}</View>
-    </CustomSafeAreaView>
-  );
-}
-- 
cgit v1.2.3-70-g09d2

